Loose checking returns some crazy, counter-intuitive results when used with certain arrays. It is completely correct behaviour, due to PHP's leniency on variable types, but in "real-life" is almost useless.
The solution is to use the strict checking option.
<?php
$array = array(
'egg' => true,
'cheese' => false,
'hair' => 765,
'goblins' => null,
'ogres' => 'no ogres allowed in this array'
);
in_array(null, $array); in_array(false, $array); in_array(765, $array); in_array(763, $array); in_array('egg', $array); in_array('hhh', $array); in_array(array(), $array); in_array(null, $array, true); in_array(false, $array, true); in_array(765, $array, true); in_array(763, $array, true); in_array('egg', $array, true); in_array('hhh', $array, true); in_array(array(), $array, true); ?>